import service from "@/utils/request";

export default {
  /**
   * 库存查询
   * @returns {Promise<AxiosResponse<any>>}
   * @param params
   */
  list (params) {
    return service.get('/purchase/queryWare', { params })
  },

  /**
   * 查询进货申请
   * @param params
   * @returns {Promise<AxiosResponse<any>>}
   */
  applyList (params) {
    return service.get('/purchase/queryApply', { params })
  },

  /**
   * 添加进货申请
   * @param data
   * @returns {Promise<AxiosResponse<any>>}
   */
  addApply (data) {
    return service.post('/purchase/stockApply', data)
  },

  /**
   * 更新申请
   * @param data
   * @returns {Promise<AxiosResponse<any>>}
   */
  updateApply (data) {
    return service.post('/purchase/updateApply', data)
  },

  /**
   * 删除申请
   * @param data
   * @returns {Promise<AxiosResponse<any>>}
   */
  deleteApply (data) {
    return service.post('/purchase/deleteApply', data)
  },

  /**
   * 获取详细进货单
   */
  getDetailItems (formNumber) {
    return service.get('/purchase/getByNumber', {
      params: {
        formNumber
      }
    })
  },

  /**
   * 更新详细进货单
   */
  updateDetailItems (data) {
    return service.post('/purchase/updateDetailItem', data)
  },

  /**
   * 填写详细进货申请
   */
  reviewDetailItems (data) {
    return service.post('/purchase/detailInput', data)
  },

  /**
   * 批量进货成功
   */
  updateStatus (inputNum) {
    return service.get('/purchase/updateStatus', {
      params: {
        inputNum
      }
    })
  }
}
